package com.lanan.springboot.service;

import com.lanan.springboot.model.Code;

/**
 * @desc ICodeService
 * @author lanan
 * @date 2022-04-30 21:59:05
 **/
public interface ICodeService {
    Code selectByCode(String _code);

    /**
     * @desc 查询没有用过的code
     * @author lanan
     * @date 2022-04-11 22:34:14
     * @param userId
     * @param email
     * @param mobile
     * @return com.lanan.springboot.model.Code
     **/
    Code selectNotUsedCode(Integer userId, String email, String mobile);

    /**
     * @desc 创建一条验证码记录
     * @author lanan
     * @date 2022-04-11 22:34:21
     * @param userId
     * @param email
     * @param mobile
     * @return com.lanan.springboot.model.Code
     **/
    Code createCode(Integer userId, String email, String mobile);

    /**
     * @desc 验证邮箱验证码
     * @author lanan
     * @date 2022-04-11 22:34:27
     * @param userId
     * @param email
     * @param mobile
     * @param _code
     * @return com.lanan.springboot.model.Code
     **/
    Code validateCode(Integer userId, String email, String mobile, String _code);

    /**
     * @desc 发送邮件
     * @author lanan
     * @date 2022-04-11 22:34:33
     * @param userId
     * @param email
     * @param title
     * @param content
     * @return boolean
     **/
    boolean sendEmail(Integer userId, String email, String title, String content);

    /**
     * @desc 发送短信
     * @author lanan
     * @date 2022-04-11 22:34:39
     * @param mobile
     * @return boolean
     **/
    boolean sendSms(String mobile);

    void update(Code code);

    /**
     * @desc 根据用户id删除评论记录
     * @author lanan
     * @date 2022-04-11 22:34:47
     * @param userId
     * @return void
     **/
    void deleteByUserId(Integer userId);
}
